#ifndef __LUOO_TCP_RECV_BUFFER_HPP__
#define __LUOO_TCP_RECV_BUFFER_HPP__

#include <boost/asio.hpp>

#include "luoo_typedef.h"

namespace luoo
{
	class tcp_recv_buffer
	{
	private:
		enum { DEFAULE_BUFFER_SIZE = 1024 };

	public:
		boost::asio::streambuf::mutable_buffers_type prepare(luoo::uint32 n = DEFAULE_BUFFER_SIZE)
		{
			return recv_buffer_.prepare(n);
		}

		void commit(luoo::uint32 n)
		{
			recv_buffer_.commit(n);
		}
		
		std::size_t size() const
		{
			return recv_buffer_.size();
		}

		luoo::uint8* peek() const
		{
			return const_cast<luoo::uint8*>(boost::asio::buffer_cast<const luoo::uint8*>(recv_buffer_.data()));
		}
		
		void consume(luoo::uint32 n)
		{
			recv_buffer_.consume(n);
		}
	private:
		boost::asio::streambuf recv_buffer_;
	};
}//namespace luoo

#endif//__LUOO_TCP_RECV_BUFFER_HPP__s